package com.heiye.relation.biz.rpc;

import com.heiye.framework.common.response.Response;
import com.heiye.quiz.api.api.QuizFeignApi;
import com.heiye.quiz.api.dto.req.CheckNoteIsExistReqDTO;
import com.heiye.quiz.api.dto.resp.CheckQuizIsExistRespDTO;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;

/**
 * @author: heiye
 * @date: 2025/04/15 下午4:52
 * @version: v1.0.0
 * @description: RPC： 问题服务
 */
@Component
public class QuizRpcService {

    @Resource
    private QuizFeignApi quizFeignApi;

    public CheckQuizIsExistRespDTO checkNoteIsExist(Long quizId) {
        CheckNoteIsExistReqDTO checkNoteIsExistReqDTO = new CheckNoteIsExistReqDTO();
        checkNoteIsExistReqDTO.setQuizId(quizId);

        Response<CheckQuizIsExistRespDTO> result = quizFeignApi.checkNoteIsExist(checkNoteIsExistReqDTO);

        if (!result.isSuccess()) {
            return null;
        }

        return result.getData();
    }
}
